package com.example.questionnaire.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.questionnaire.dto.AnswererAddDto;
import com.example.questionnaire.entity.AnswererEntity;
import com.example.questionnaire.entity.QuestionnaireEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author hsz
 * @email 1416446590@qq.com
 * @date 2022-10-29 11:20:57
 */
@Mapper
public interface AnswererDao extends BaseMapper<AnswererEntity> {
    AnswererEntity findByAnswerername(String username);

    void modifyAnswererInfo(AnswererEntity answererEntity);

    AnswererEntity findByAnswererId(Integer id);

    void delAnswerer(int id);

    AnswererEntity findByTelephone(String telephone);

    AnswererEntity queryAnswererByDto(AnswererEntity answererEntity);

    Integer findAnswererByTeamId(Integer teamId);

    IPage<Map<String, Object>> selectAnswerersTeam(Page<AnswererEntity> objectPage,  @Param("ew")QueryWrapper<AnswererEntity> wrapper);

    IPage<Map<String, Object>> selectAnswerersUser(Page<AnswererEntity> answererEntityPage, @Param("ew")QueryWrapper<AnswererEntity> wrapper);

    List<Integer> findQuestionnaireIdByAnswererId(Integer answererId);

    List<QuestionnaireEntity> findQuestionnaireByKeyWord(List<Integer> questionnaireIdList, String keyword);

    void addAnswererTeamInfo(AnswererAddDto answererAddDto);

    AnswererEntity login(String username,String password);
}
